<template>
	<view class="content">
        <u-navbar :fixed="true" :shadow="true" :safeAreaInsetTop="true" :placeholder="true"
            @leftClick="back" title="单位详情"> <!-- 原为企业详情 据(基础信息优化工作20220326_APP优化)文档修改 -->
        </u-navbar>

        <view class="uni-area">
            <view class="u-m-t-40 u-font-32 font-bold">单位信息</view> <!-- 原为企业信息 据(基础信息优化工作20220326_APP优化)文档修改 -->
            <!-- 基本信息 -->
            <uni-item-base class="u-m-t-30" :baseData="baseData" />
            <!-- 附件  -->
            <uni-accessory class="u-m-t-30 u-m-b-30" :title="{line:true,title:'附件'}" :accessorys="accessoryList" /> 
        </view>
    
        <!-- 提示组件 -->
        <u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
                // 基础信息
                baseData:{
                    line: true,
                    title: '基础信息',
                    list:[
                        // 原数据 据(基础信息优化工作20220326_APP优化)文档修改
                        // { fied:'qymc', title:'企业名称', value:'安薪乐' },
                        // { fied:'zjlx', title:'证件类型', value:'安薪乐' },
                        // { fied:'tyshxydm', title:'统一信用代码', value:'安薪乐' },
                        // { fied:'qyjydz', title:'单位地址', value:'安薪乐' },
                        // { fied:'qylx', title:'单位类型', value:'安薪乐' },
                        // { fied:'districtName', title:'所属区划', value:'安薪乐' },
                        // { fied:'zzlb', title:'主项资质类别', value:'安薪乐' },
                        // { fied:'dj', title:'资质等级', value:'安薪乐' },
                        // { fied:'frdbzjhm', title:'证件号码', value:'安薪乐' },
                        // { fied:'dwdh', title:'单位联系电话', value:'安薪乐', type:'phone' },
                        // { fied:'qyczhm', title:'单位传真', value:'安薪乐' },
                        // { fied:'dwdh', title:'手机号码', value:'安薪乐', type:'phone' },
                        // { fied:'jydzyb', title:'邮政编码', value:'安薪乐' },
                        // { fied:'rclxryx', title:'单位邮箱', value:'安薪乐' },
                        { fied:'qymc', title:'单位名称', value:'安薪乐' },
                        { fied:'tyshxydm', title:'统一信用代码', value:'安薪乐' },
                        { fied:'qylx', title:'用户类型', value:'安薪乐' },
                        { fied:'dwlx1', title:'单位类型', value:'安薪乐' },
                        { fied:'zzdj', title:'资质等级', value:'安薪乐' },
                        { fied:'sdfl', title:'属地分类', value:'安薪乐' },
                        { fied:'qyjydz', title:'办公地址', value:'安薪乐' },
                        { fied:'zcdDistrictName', title:'注册地行政区划', value:'安薪乐' },
                        { fied:'qygszcszd', title:'注册地址', value:'安薪乐' },
                        { fied:'frdb', title:'法人姓名', value:'安薪乐' },
                        { fied:'frdbzjhm', title:'法人身份证号', value:'安薪乐'},
                        { fied:'frsjhm', title:'法人电话', value:'安薪乐', type:'phone'  },
                        { fied:'currencytype', title:'注册币种', value:'安薪乐' },
                        { fied:'zczb', title:'注册资本(万元)', value:'安薪乐' },
                        { fied:'zcrq', title:'注册日期', value:'安薪乐' },
                        { fied:'jydzyb', title:'邮政编码', value:'安薪乐' },
                        { fied:'rclxryx', title:'单位邮箱', value:'安薪乐' },
                        { fied:'textarea', title:'备注', value:'安薪乐' },
                        
                    ]
                },
                // 附件
                accessoryList:[],
			}
		},


		onLoad(option) {
            // 企业信息
            this.getProjectDetail(option.id)
		},


		methods: {
            // 返回
            back(){
                uni.navigateBack()
            },

            // 企业信息
            getProjectDetail(id){
                uni.showLoading({ title:'企业信息加载中' })
                const api = JSON.parse(JSON.stringify(this.$apis.EntDetail)) 
                api.url = api.url+'/'+id
                this.$request(this,api, {}).then(res=>{
                    // console.log('企业信息',res)
                    this.baseData.list.map((v,i)=>{
                        v.value = res[v.fied]||res[v.fied]==0?res[v.fied]:'暂无数据源'
                    })
                    // 企业信息附件
                    this.getCommonAccessory(id)
                }).then()
            },


            // 企业信息附件
            getCommonAccessory(ywbh){
                uni.showLoading({ title:'附件加载中' }) 
                const parameter = {
                    ywlx: 'salary_core_dept_mx', // 业务类型
                    ywbh: ywbh, // 业务编号
                }
                this.$request(this, this.$apis.MemberAtta, parameter).then(res=>{
                    // console.log('企业信息附件',res)
                    this.accessoryList = res
                }).then() 
            },
		}
	}
</script>

<style scoped lang="scss">
    // .content{}
</style>
